how to detect palindrome in javascript